<template>
    <div class="shop-info">
        <div class="shop-top">
            <div class="shop-top-image">
                <img :src="shopInfo.logo" alt="logo">
            </div>
            <span class="title">{{ shopInfo.name }}</span>
        </div>
        <div class="shop-middle">
             <div class="shop-middle-item shop-middle-left">
                 <div class="info-sells">
                     <div class="sells-count">
                         {{ shopInfo.sells | sellCountFilter }}
                     </div>
                     <div class="sells-text">总销量</div>
                 </div>
                 <div class="info-goods">
                     <div class="goods-count">
                         {{ shopInfo.goodsCount }}
                     </div>
                     <div class="goods-text">全部宝贝</div>
                 </div>
             </div>
              <div class="shop-middle-item shop-middle-right">
                   <table>
                        <tr v-for="(item, i) in shopInfo.score" :key="i">
                            <td>{{ item.name }}</td>
                            <td class="score scoreA" :class="{'score-better': item.isBetter}">{{ item.score }}</td>
                           <td class="score" :class="{'better-more': item.isBetter}"><span>{{ item.isBetter? '高': '低' }}</span></td>
                        </tr>
                   </table>
              </div>
        </div>
        <div class="shop-bottom">
            <div class="enter-shop">进店逛逛</div>
        </div>
  </div>
</template>

<script>
export default {
    name: 'DetailShopInfo',
    props:{
      shopInfo: {
        type: Object,
        default() {
           return {}
        }
      }
    },
    filters: {
        sellCountFilter: function(value) {
            if(value <10000) return value
            return (value/10000).toFixed(1) + '万'
        }
    }
}
</script>

<style>
.fenge{
  padding: 20px 0 20px 0;
  color: #000;
}
.shop-middle-right .score {
    color: #5ea732;
}
.shop-middle-right .score-better {
    color: #f13e3a;
}
.shop-middle-right .score span {
    color: #5ea732;
    background-color: #5ea732;
    color: #fff;
    text-align: center;
}
.shop-middle-right .score-better span {
    color: #f13e3a;
    background-color: #f13e3a;
    color: #fff;
    text-align: center;
}

.shop-info{
    padding: 0 16px;
}
.shop-top{
   padding: 15px 0;
   height: 45px;
}
.shop-top .shop-top-image{
    float: left;
    width: 45px;
    border-radius: 15px;
    overflow: hidden;
}
.shop-top .shop-top-image img{
    width: 100%;
    height: 100%;
}
.shop-top .title{
    padding-left: 8px;
    float: left;
    line-height: 45px;
    color: rgba(0, 0, 0, 0.7);
    font-weight: bold;
}
.shop-middle{
    padding-bottom: 5px;
    display: flex;
    height: 95px;
}
.shop-middle-left{
    flex: 1;
}
.shop-middle-left .info-sells,
.shop-middle-left .info-goods{
   margin-top: 20px;
   width: 50%;
   height: 60%;
   float: left;
   text-align: center;
}
.shop-middle-left .info-sells .sells-count,
.shop-middle-left .info-goods .goods-count{
    font-weight: 600;
    font-size: 20px;
    padding-bottom: 10px;
}
.shop-middle-left .info-sells .sells-text,
.shop-middle-left .info-goods .goods-text{
    font-size: 15px;
    font-weight: 400;
}
.shop-middle-right{
    flex: 1;
    text-align: center;
}
.shop-middle-right table{
    display: inline-block;
    text-align: left;
}
.shop-middle-right table td{
    padding: 6px 0;
    font-size: 15px;
}
.shop-middle-right .scoreA{
   padding: 0 6px 0 10px;
}
.shop-bottom{
    width: 100%;
    height: 33px;
    
}
.shop-bottom .enter-shop{
    /* width: 120px; */
    width: 150px;
    height: inherit;
    margin: 0 auto;
    text-align: center;
    line-height: 33px;
    background-color: #e4e4e4;
    font-size: 15px;
    border-radius: 15px;
}
</style>
